home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’95
/
WelcomeToMacDialogsSuck
/
Part 3
/
WelcomeToMacintoshDialogsSuck.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-24
|
3KB
|
154 lines
#include <resources.h>
#include <quickdraw.h>
#include <Events.h>
void main( void);
void DoWelcomeToMacintosh( void);
void WhereToDrawMyPicture( Rect *r, PicHandle p);
void DrawMyPicture( PicHandle p);
void OffSetPictRect( Rect *rect);
void DrawMyEaterPicture( PicHandle p);
void CalcPictOffset(
Point *offset,
Point screenSize,
Rect *pictRect);
Point *GetScreenSizePointPtr( void) =
{ 0x41ED, 0xFF8C };
#define __APPLICATION__ 0
#if __APPLICATION__
Point gScreenSize = {480, 640};
#endif
void main( void)
{
#if __APPLICATION__
Debugger();
InitGraf( &qd.thePort);
InitWindows();
SetApplLimit( GetApplLimit() -50000);
#endif
DoWelcomeToMacintosh();
}
void DoWelcomeToMacintosh( void)
{
PicHandle badPict, goodPict;
short rsrcNum;
Rect rect;
/*
rsrcNum = 1;
if( IsPressed1( 0x0F))
rsrcNum = 2;
*/
badPict = GetPicture( 5);
goodPict = GetPicture( 1);
if( badPict && goodPict)
{
WhereToDrawMyPicture( &rect, badPict);
OffsetRect( &rect, 0, -32);
DrawPicture( badPict, &rect);
FrameRect( &rect);
InsetRect( &rect, 2, 2);
PenSize( 2, 2);
FrameRect( &rect);
DrawMyEaterPicture( goodPict);
// ReleaseResource( (Handle) badPict);
// ReleaseResource( (Handle) goodPict);
}
}
void DrawMyEaterPicture( PicHandle p)
{
Rect rect;
short Vdelta;
Rect eraseRect;
short i;
unsigned char grayPat[8];
for( i = 0; i < 8; i+=2)
{
grayPat[i+0] = 0xAA;
grayPat[i+1] = 0x55;
}
WhereToDrawMyPicture( &rect, p);
Vdelta = rect.bottom;
#define SLOW 3
#define FAST 8
#define VFAST 16
eraseRect = rect;
eraseRect.bottom = eraseRect.top +SLOW;
rect.top -= Vdelta;
rect.bottom -= Vdelta;
eraseRect.top -= Vdelta;
eraseRect.bottom -= Vdelta;
for( i = 0; i < (Vdelta >>2); i+= SLOW)
{
rect.top += SLOW;
rect.bottom += SLOW;
eraseRect.top += SLOW;
eraseRect.bottom += SLOW;
DrawPicture( p, &rect);
FillRect( &eraseRect, (PatPtr) grayPat);
}
eraseRect.bottom = eraseRect.top +FAST;
for( ; i < (Vdelta >>1); i += FAST)
{
rect.top += FAST;
rect.bottom += FAST;
eraseRect.top += FAST;
eraseRect.bottom += FAST;
DrawPicture( p, &rect);
FillRect( &eraseRect, (PatPtr) grayPat);
}
eraseRect.bottom = eraseRect.top +VFAST;
for( ; i < Vdelta; i += VFAST)
{
rect.top += VFAST;
rect.bottom += VFAST;
eraseRect.top += VFAST;
eraseRect.bottom += VFAST;
DrawPicture( p, &rect);
FillRect( &eraseRect, (PatPtr) grayPat);
}
DrawPicture( p, &rect);
}
void WhereToDrawMyPicture( Rect *rect, PicHandle p)
{
short width, height;
Point *screenSize;
screenSize = GetScreenSizePointPtr();
*rect = (**p).picFrame;
width = rect->right - rect->left;
height = rect->bottom - rect->top;
rect->left = 0;
rect->top = 0;
rect->right = width;
rect->bottom = height;
if( (width <= 32) ||
(height <= 32))
{
width *= 5;
height *= 5;
rect->right += width;
rect->bottom += height;
}
OffsetRect( rect, (screenSize->h - width) >>1,
(screenSize->v - height) >>1);
}